<?php
namespace Utuo;

class DBRW {
	
	public static function openAndClose( $status ) {
		static $rwStatus = array();
		if ( $status ) {
			$rwStatus[] = 1; // 开启
//			C('DB_HOST', SAE_MYSQL_HOST_M.','.SAE_MYSQL_HOST_S);
			C('DB_HOST', 'localhost'); // 关闭
		} else {
		    $last2 = null;
			isset($rwStatus[count($rwStatus)-2]) and $last2 = $rwStatus[count($rwStatus)-2];
			if ( !$last2 ) {
//				C('DB_HOST', SAE_MYSQL_HOST_M); // 关闭
				C('DB_HOST', 'localhost'); // 关闭
			}
			array_pop($rwStatus);
		}
	}
	
	
}